package com.utooo.service.purchase;


import com.utooo.dao.purchase.DemandMaterialDetailMapper;
import com.utooo.dao.purchase.PurchaseTaskManagementMapper;
import com.utooo.dao.purchase.requirement.PurchaseRequirementChangeMapper;
import com.utooo.dao.purchase.requirement.PurchaseRequirementMapper;
import com.utooo.dao.quality.GeneralRectificationMapper;
import com.utooo.dao.quality.MultiRectificationMapper;
import com.utooo.dao.supplier.SupplierSampleFeedbackMapper;
import com.utooo.dao.supplier.SupplierSurveyMapper;
import com.utooo.pojo.dto.purchase.NextNoGetByTypeDto;
import com.utooo.util.GenerateReceiptNo;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

/**
 * @Description: TODO
 * @Author SJD
 * @Date: 2025/4/28 15:43
 * @Copyright: 南京优通信息科技股份有限公司
 */
@Service
@RequiredArgsConstructor
public class NextNoGetServiceImpl implements NextNoGetService{

    private final MultiRectificationMapper buyerMultiRectificationMapper;
    private final GeneralRectificationMapper buyerGeneralRectificationMapper;
    private final DemandMaterialDetailMapper demandMaterialDetailMapper;
    private final PurchaseRequirementMapper requirementMapper;
    private final PurchaseRequirementChangeMapper requirementChangeMapper;
    private final SupplierSampleFeedbackMapper supplierSampleFeedbackMapper;
    private final SupplierSurveyMapper supplierSurveyMapper;
    private final PurchaseTaskManagementMapper purchaseTaskManagementMapper;

    @Override
    public String getNextNo(NextNoGetByTypeDto param) {
        return switch (param.getType()) {
            // 1-8D整改类型  2-一般整改类型
            case 1 -> GenerateReceiptNo.getGenerateReceiptNo("sch1", "comInputField102", buyerMultiRectificationMapper);
            case 2 -> GenerateReceiptNo.getGenerateReceiptNo("sch2", "comInputField102", buyerGeneralRectificationMapper);
            case 3 -> GenerateReceiptNo.getGenerateReceiptNo("SCHF", "comInputField155", requirementMapper);
            case 4 -> GenerateReceiptNo.getGenerateReceiptNo("SQTK", "comInputField101", purchaseTaskManagementMapper);
            case 5 -> GenerateReceiptNo.getGenerateReceiptNo("SCHT", "comInputField166", requirementChangeMapper);
            case 6 -> GenerateReceiptNo.getGenerateReceiptNo("SCHT", "comInputField102", supplierSampleFeedbackMapper);
            case 7 -> GenerateReceiptNo.getGenerateReceiptNo("SCHT", "comInputField102", supplierSurveyMapper);

            default -> "error";
        };
    }
}
